Modern Web Development with Angular: Build Cutting-Edge, Scalable Web Apps from Scratch with Angular, TypeScript, and Reactive Programming by Duncan Faulkner & Pierre Bouillon

Modern Web Development with Angular: Build Cutting-Edge, Scalable Web Apps from Scratch with Angular, TypeScript, and Reactive Programming by Duncan Faulkner & Pierre Bouillon

Author:Duncan Faulkner & Pierre Bouillon [Faulkner, Duncan & Bouillon, Pierre]
Language: eng
Format: epub
ISBN: 9788196815073
Publisher: Orange Education Pvt Ltd, AVA™
Published: 2024-12-15T00:00:00+00:00


Observables

Observables are the implementation of the pattern we mentioned earlier. While it’s possible to create one ourselves, RxJS comes with a lot of methods that return new Observables with various behaviors, saving us a lot of code and potential mistakes.

For instance, the of method creates a new Observable from a single value and emits it:

import { of } from 'rxjs';

const luckyNumber$ = of(13);

Note: Did you notice the $ sign after the Observable ? By convention, any variable that can be observed ends with an $. This naming helps to identify what is an observable and what is not.

of is just one of the many functions we can use to create an Observable . For example, interval(period) creates an Observable that will emit a number after a specified period, but others can create observables from events like a click, and much more. The full list can be accessed on the RxJS website at https://rxjs.dev/guide/operators .



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.